<?php

namespace App\Models;

use App\Helpers\BaseModel;
use App\Helpers\RequestCriteria;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class EarlyAlarm extends Model
{
    use HasFactory, RequestCriteria, BaseModel;
    protected $fillable = [
        'name',
        'type',
        'level',
        'e_s_cluster_id'
    ];
    protected $casts = [
        'updated_at' => 'datetime:Y-m-d H:i:s',
        'created_at' => 'datetime:Y-m-d H:i:s',
    ];
    
    public function ESCluster()
    {
        return $this->belongsTo(ESCluster::Class);
    }
    public function operation()
    {
        return $this->morphOne(Operation::class, 'alarm');
    }
}
